package org.peterbjornx.io;

import java.io.*;

public class DiskFileStore implements AbstractFileStore {

	private File parentfolder;

	public DiskFileStore(String folder){
		parentfolder = new File(folder);
	}

	public RSInputStream getFile(String name) throws IOException{
        File f =new File(parentfolder,name);
		return new RSInputStream(new FileInputStream(f),(int)f.length());
	}

    public byte[] getData(String s) throws IOException {
        File f =new File(parentfolder,s);
        byte d[] = new byte[(int) f.length()];
	    new RSInputStream(new FileInputStream(f),(int)f.length()).readFully(d,0,d.length);
        return d;
    }
}